<?php


namespace App\Evaluation\Actions\Post;

use App\Extensions\Actions\RowAction;
use App\PatentAssess;
use Encore\Admin\Facades\Admin;
use Illuminate\Http\Request;

class PatentAssessReturnPost extends RowAction
{
    public $name = '退回不评';

    public function handle(PatentAssess $model)
    {
        if ($model['expert_id'] != Admin::user()->id) {
            return $this->response()->swal()->error('没有权限！')->refresh();
        }
        $model->delete();
        return $this->response()->success('操作完成！')->refresh();
    }

    public function dialog()
    {
        return $this->confirm('确定退回不评吗？');
    }

}
